package interview.common;

import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description: 定义Node
 * User: xxm
 * Date: 2018-02-18
 * Time: 14:55
 */
public class Node {

    private final int value;
    private Node next;

    public Node(int value) {
        this.value = value;
        // 保证每次创建的Node都是干净的
        this.next = null;
    }

    public int getValue() {
        return value;
    }

    public Node getNext() {
        return next;
    }

    public void setNext(Node next) {
        this.next = next;
    }

    public static void printLinkedList(Node head) {
        while (head != null) {
            System.out.print(head.getValue());
            System.out.print(" ");
            head = head.getNext();
        }
        System.out.println();
    }
}
